package com.flashextended.apps.logomaker.view.menu
{
	import com.flashextended.apps.logomaker.controlers.Controlers;
	import com.flashextended.apps.logomaker.singleton.AppLocales;
	import com.flashextended.utils.graphics.buttons.VistaButton;
	
	import flash.display.Bitmap;
	
	import mx.core.UIComponent;

/**
 * Menu class
 * handles menu from bottom of the application
 */ 
	public class Menu extends UIComponent
	{
		//public static const WDT:Number=530;
		
		public static const WDT:Number=530;
		public static const HDT:Number=80;
		
	    [Embed(source="../assets/images/new_project.png")]
	    private var NewProject:Class;
	    private var newProject:VistaButton;
	    
	    [Embed(source="../assets/images/add_text.png")]
	    private var AddText:Class;
	    private var addText:VistaButton;
	    
	    [Embed(source="../assets/images/add_image.png")]
	    private var AddImage:Class;
	    private var addImage:VistaButton;
	    
	    [Embed(source="../assets/images/add_symbol.png")]
	    private var AddSymbol:Class;
	    private var addSymbol:VistaButton;
	    
	    [Embed(source="../assets/images/save_logo.png")]
	    private var SaveLogo:Class;
	    private var saveLogo:VistaButton;
	    
	    [Embed(source="../assets/images/preview.png")]
	    private var PreviewLogo:Class;
	    private var previewLogo:VistaButton;
		
		[Embed(source="../assets/images/open_project.png")]
		private var OpenProject:Class;
		private var openProject:VistaButton;
		
		[Embed(source="../assets/images/save_project2.png")]
		private var SaveProject:Class;
		private var saveProject:VistaButton;
		
		[Embed(source="../assets/images/apple_img.png")]
		private var AppleImg:Class;		
		
		public function Menu()
		{
			super();
			settings();
			
			var apple:Bitmap = new AppleImg();
			apple.y-=14;
			apple.x-=40;
			apple.alpha = 1;
			this.addChild(apple);
			
			newProject = new VistaButton(new NewProject(), AppLocales.getInstance().data.locales["newProject"]);
			this.addChild(newProject);
			
			openProject = new VistaButton(new OpenProject(), AppLocales.getInstance().data.locales["openProject"]);
			this.addChild(openProject);
			openProject.move(newProject.x+newProject.width+10, 0);
			
			saveProject = new VistaButton(new SaveProject(), AppLocales.getInstance().data.locales["saveProject"]);
			this.addChild(saveProject);
			saveProject.move(openProject.x+openProject.width+10, 0);			
			
			addText = new VistaButton(new AddText(), AppLocales.getInstance().data.locales["addText"]);
			this.addChild(addText);
			addText.move(saveProject.x+saveProject.width+50, 0);
			
			addImage = new VistaButton(new AddImage(), AppLocales.getInstance().data.locales["addImage"]);
			this.addChild(addImage);
			addImage.move(addText.x+addText.width+10, 0);	
			
			addSymbol = new VistaButton(new AddSymbol(), AppLocales.getInstance().data.locales["addSymbol"]);
			this.addChild(addSymbol);
			addSymbol.move(addImage.x+addImage.width+10, 0);
			
			saveLogo = new VistaButton(new SaveLogo(), AppLocales.getInstance().data.locales["saveLogo"]);
			this.addChild(saveLogo);
			saveLogo.move(addSymbol.x+addSymbol.width+50, 0);
			
			previewLogo = new VistaButton(new PreviewLogo(), AppLocales.getInstance().data.locales["previewLogo"]);
			this.addChild(previewLogo);
			previewLogo.move(saveLogo.x+saveLogo.width+10, 0);
			
			Controlers.getInstance().addMouseAction(newProject, Controlers.getInstance().newProjectListener);
			Controlers.getInstance().addMouseAction(saveProject, Controlers.getInstance().saveProjectListener);
			Controlers.getInstance().addMouseAction(openProject, Controlers.getInstance().loadProjectListener);
			
			Controlers.getInstance().addMouseAction(addText, Controlers.getInstance().addTextListener);
			
			Controlers.getInstance().addMouseAction(addImage, Controlers.getInstance().addImageListener);
			Controlers.getInstance().addMouseAction(addSymbol, Controlers.getInstance().addSymbolListener);
			Controlers.getInstance().addMouseAction(saveLogo, Controlers.getInstance().saveLogoListener);
			Controlers.getInstance().addMouseAction(previewLogo, Controlers.getInstance().previewLogoListener);						
		}
		
		private function settings():void
		{
			this.width = WDT;
			this.height = HDT;
			this.setStyle("backgroundColor", 0xFFFFFF);
			//Alert.show("AICI");
		}
		
	}
}